package io.jt808.proto.item;


import io.norland.buffer.AutoBuffer;
import io.norland.proto.IProto;


public class PositionAdditional13RouteDriveTimeAlarmAdditional implements IProto {
    private int routeId;
    private int driveTime;
    private int result;

    public byte[] writeToBytes() {
        AutoBuffer buffer = new AutoBuffer();
        buffer.writeInt(this.routeId);
        buffer.writeShort(this.driveTime);
        buffer.writeByte(this.result);
        return buffer.array();
    }

    public void readFromBuf(AutoBuffer buffer) {
        this.routeId = buffer.readInt();
        this.driveTime = buffer.readShort();
        this.result = buffer.readByte();
    }

    public String getResult() {
        return result == 0 ? "不足" : "过长";
    }
}